package com.example.stroebackstage.service;
import com.example.stroebackstage.dao.CategoryDao;
import com.example.stroebackstage.dao.CommoditiesDao;
import com.example.stroebackstage.entity.Commodity;
import java.util.ArrayList;
import java.util.HashMap;

public class CommodityService {
    public ArrayList<Commodity> selectAll() {
        return CommoditiesDao.selectCommodity();
    }
    public ArrayList<Commodity> selectById(int id) {
        return CommoditiesDao.selectCommodity(id);
    }
    public ArrayList<Commodity> selectByName(String name) {
        return CommoditiesDao.selectCommodity(name);
    }
    public boolean del(int id) {
        return CommoditiesDao.delCommodity(id);
    }
    public boolean updateCommodity(Commodity commodity) {
        return CommoditiesDao.updateCommodity(commodity);
    }
    public boolean insert(Commodity commodity) {
        return CommoditiesDao.insertCommodity(commodity);
    }
    public HashMap<Integer, String> selectCategory() {
        return CategoryDao.selectCategory();
    }
    public boolean delCategory(int id) {
        return CategoryDao.delCategory(id);
    }
    public boolean updateCommodityCategory(int id,String name) {
        return CategoryDao.updateCategory(id, name);
    }
    public boolean insertCategory(String name) {
        return CategoryDao.insertCategory(name);
    }
}
